package com.evriko.commenterall.server;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.jdo.PersistenceManager;
import javax.jdo.Query;

import com.evriko.commenterall.api.dao.ReviewDao;
import com.evriko.commenterall.api.manager.ReviewManager;
import com.evriko.commenterall.api.pojo.IReview;
import com.evriko.commenterall.api.pojo.Review;
import com.evriko.commenterall.impl.appengine.dao.ReviewDaoAppengineImpl;
import com.evriko.commenterall.persistence.PMF;

/**
 * @author Volodymyr.Petrusha vladimir@petrusha.net
 * @version $Id ReviewManagerImpl.java 16:30:52
 */
/**
 * @author Volodymyr.Petrusha
 *
 */
public class ReviewManagerImpl implements ReviewManager {
	private static final Logger log = Logger.getLogger(ReviewManagerImpl.class.getName());
	private ReviewDao dao = new ReviewDaoAppengineImpl();
	
	public List<IReview> getLatestReview() {
		return getReviewsByCriteria(new ReviewsCriteria()); 
	}

	
	public List<IReview> getLatestReviewBySource(String source) {
		return Collections.emptyList();
	}

	
	public List<IReview> getReviewsByCriteria(ReviewsCriteria criteria) {
		List<IReview> reviews = dao.getReviewsByCriteria(criteria);
		return reviews;
	}
	
	public Boolean saveReview(Review review) {
		return dao.saveReview(review); 
	}
}
